import os

rootPath = 'E:/code/cocos/kneelman100/assets/images/Player'

allSize = 0

fileSize = 0

def walk(path):
    global allSize
    global fileSize
    for item in os.listdir(path):
        curName = os.path.join(path, item)
        if os.path.isdir(curName):
            walk(curName)
        else:
            if not item.endswith(".png"):
                continue
            else:
                cur_size = os.path.getsize(curName)
                allSize += cur_size
                print(curName)

if __name__ == '__main__':
    walk(rootPath)
    print('=' * 100)
    print(f'最终大小为{allSize}')

